<?php

Loader::using("ext::libs::restful::RESTfulClient");
Loader::using("Models::Entities::Terminales");

class TerminalesService extends RESTfulClient {

    public function GetAll() {
        $response = $this->call("/", "GET");
        $deserializer = $this->getDeserializer();
        return $deserializer->deserialize("Terminales", $response);
    }

    public function GetDeleted() {
        $response = $this->call("Eliminados/", "GET");
        $deserializer = $this->getDeserializer();
        return $deserializer->deserialize("Terminales", $response);
    }

    public function Restore($id) {
        $response = $this->call("Restaurar/$id/", "GET");
        $deserializer = $this->getDeserializer();
        return $deserializer->deserialize("Terminales", $response);
    }

    public function GetById($id) {
        $response = $this->call("/$id", "GET");
        $deserializer = $this->getDeserializer();
        return $deserializer->deserialize("Terminales", $response);
    }

    public function Update(Terminales $terminal) {
        $serializer = $this->getSerializer();
        $data = $serializer->serialize($terminal);
        $this->call("/{$terminal->getIdTerminal()}", "PUT", $data);
    }

    public function Create(Terminales $terminal) {
        $serializer = $this->getSerializer();
        $data = $serializer->serialize($terminal);
        $this->call("/new", "POST", $data);
    }

    public function GetByPuerto($idPuerto) {
        $terminales = $this->call("/ByPuerto/$idPuerto", "GET");
        return $this->getDeserializer()->deserialize("Terminales", $terminales);
    }

    public function Remove($id) {
        $this->call("/$id", "DELETE");
    }

}

?>
